//
//  DHChangeNicknameController.m
//  Dresshere
//
//  Created by ZhangPeng on 2018/6/26.
//  Copyright © 2018年 张朋. All rights reserved.
//

#import "DHChangeNicknameController.h"

@interface DHChangeNicknameController ()
@property (weak, nonatomic) IBOutlet UITextField *ncTF;
@property (weak, nonatomic) IBOutlet UITextField *qmTF;

@end

@implementation DHChangeNicknameController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.titleLabel.text = @"修改昵称";

}

- (IBAction)ensureAction:(id)sender {
    if (self.ncTF.text.length == 0 && self.qmTF.text.length == 0) {
        [NSObject showHudTipStr:@"请输入昵称或签名"];
        return;
    }
    NSMutableDictionary *params = [NSMutableDictionary dictionary];
    if (self.ncTF.text.length > 0) {
        [params setObject:self.ncTF.text forKey:@"nickname"];
    }
    if (self.qmTF.text.length > 0) {
        [params setObject:self.qmTF.text forKey:@"title"];
    }
    [[DHNetAPIClient shareDHNetAPIClient] request_user_nicknameWithParams:params andBlock:^(id data, NSError *error) {
        [[GlobalManager shareGlobalManager] refreshBasicInfoAndBlock:^(id data, NSError *error) {
            [NSObject showHudTipStr:@"修改成功"];
            [self.navigationController popViewControllerAnimated:YES];
        }];
    }];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
